create  table jms_dm.dm_terminal_tran_direct_delivery_detail_dt
(
end_agent_code           varchar(100) COMMENT '末端代理区code' ,
end_provider_id          varchar(100) COMMENT '末端网点所属省ID' ,
end_city_id              varchar(100) COMMENT '末端网点所属城市id' ,
final_sign_network_code  varchar(100) COMMENT '规划签收网点code' ,
waybill_no               varchar(100) COMMENT '运单号' ,
package_code             varchar(100) COMMENT '包号' ,
scan_time                varchar(100) COMMENT '扫描时间' ,
package_type             varchar(100) COMMENT '包类型' ,
third_package_code       varchar(100) COMMENT '包三段码' ,
second_package_code      varchar(100) COMMENT '包二段吗' ,
report_time              varchar(100) COMMENT '错分上报时间' ,
is_ass                   varchar(100) COMMENT '是否错分' ,
end_provider_name        varchar(100) COMMENT '末端网点所属省' ,
end_city_name            varchar(100) COMMENT '末端网点所属城市' ,
end_area_id              varchar(100) COMMENT '末端网点所属区县ID' ,
end_area_name            varchar(100) COMMENT '末端网点所属区县' ,
end_agent_name           varchar(100) COMMENT '末端代理区名字' ,
end_center_code          varchar(100) COMMENT '末端中心code' ,
end_center_name          varchar(100) COMMENT '末端中心名字' ,
end_network_arrival_time varchar(100) COMMENT '末端网点到件时间' ,

final_sign_network_name  varchar(100) COMMENT '规划签收网点' ,
third_code               varchar(100) COMMENT '运单三段码' ,
code                     varchar(100) COMMENT '三段码维护的三段码(出仓单元区域号)' ,
is_right_third_code      int(6) COMMENT '三段码是否准确' ,
deliver_time             varchar(100) COMMENT '出仓时间' ,
aging_sign_time          varchar(100) COMMENT '时效签收时间' ,
final_plan_sign_time     varchar(100) COMMENT '规划签收时间' ,
actual_sign_time         varchar(100) COMMENT '实际签收时间' ,
end_center_send_time     varchar(100) COMMENT '末端中心发件时间' ,
difficult_type           varchar(100) COMMENT '问题件类型' ,
difficult_time           varchar(100) COMMENT '问题件时间' ,
deliver_scan_user_code   varchar(100) COMMENT '出仓扫描员code' ,
deliver_scan_user        varchar(100) COMMENT '出仓扫描员' ,
deliver_user_code        varchar(100) COMMENT '出仓派件员code' ,
deliver_user             varchar(100) COMMENT '出仓派件员' ,
site_scan_user_code      varchar(100) COMMENT '网点扫描员' ,
site_scan_user_name      varchar(100) COMMENT '网点扫描员' ,
center_scan_user_code    varchar(100) COMMENT '中心扫描员' ,
center_scan_user_name    varchar(100) COMMENT '中心扫描员' ,
is_send_noarrival        varchar(100) COMMENT '是否是有发未到' ,
center_send_sign_hours   varchar(100) COMMENT '发签时长' ,
arrival_send_hours       varchar(100) COMMENT '到发时长' ,
deliver_sign_hours       varchar(100) COMMENT '派签时长' ,
is_arrival_send          varchar(100) COMMENT '是否到发一体' ,
date_time                date COMMENT '业务日期',
end_franchisee_code varchar(100) comment  '加盟商code',
end_franchisee_name varchar(100) comment  '加盟商'
)
ENGINE=OLAP
DUPLICATE KEY(end_agent_code,end_provider_id,end_city_id,final_sign_network_code)
comment '转运直送明细'
PARTITION BY RANGE (date_time) (
   START ("2022-09-21") END ("2022-11-20") EVERY (INTERVAL 1 day))DISTRIBUTED BY HASH(waybill_no) BUCKETS 4
PROPERTIES (
"replication_num" = "3",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-365",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "4",
"in_memory" = "false",
"storage_format" = "V2"
);
alter table jms_dm.dm_terminal_tran_direct_delivery_detail_dt add column (
   send_next_station_code varchar(100) comment '拆包网点code'
  ,send_next_station_name varchar(100) comment '拆包网点'
    ) ;